# 1.登录功能
user1 = {'id': '1001', 'username': 'zh', 'password': '123'}
user2 = {'id': '1002', 'username': 'lisi', 'password': '123'}
user3 = {'id': '1003', 'username': 'wa', 'password': '123'}
user_list = [user1, user2, user3]


def login():
    """
    return:返回登录状态，1代表登录成功，0代表登录失败
    """
    tag = 0
    name = input('请输入你的用户名:')
    pwd = input('请输入你的密码:')
    for user in user_list:
        if name == user['username'] and pwd == user['password']:
            tag = 1
            break
    if tag == 1:
        return 1
    else:
        return 0


print(login())
